home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software of the Month Club 1998 June
/
Software of the Month Club 1998 June.iso
/
pc
/
win
/
dtp
/
shopwpro
/
_setup.1
/
configure
< prev
next >
Wrap
Text File
|
1998-02-23
|
4KB
|
124 lines
#!/usr/bin/perl
$debug = 1;
$pgplocation = " ";
$pgppathlocation = " ";
print "Configuring...\n";
$maillocation = `whereis sendmail`;
$maillocation =~ s/^sendmail:\s*//;
$maillocation =~ s/\S+\.\S+//g;
@maillocation = split(/\s+/, $maillocation);
if (!@maillocation) {
print "Can't find sendmail. Aborting.\n";
exit;
} elsif (scalar(@maillocation) == 1) {
$sendmail = $maillocation[0];
} else {
print "I found more than one instance of sendmail:\n";
foreach $thing (@maillocation) {
$i++;
print "$i. $thing\n";
}
print "Which one should I use? ";
chop($answer = <STDIN>);
$answer--; # to get the index for the array
$sendmail = $maillocation[$answer];
}
print "Sendmail is set to $sendmail\n";
print "Do you want to use PGP? [Yn] ";
chop ($yesno = <STDIN>);
if (($yesno eq 'Y') || ($yesno eq 'y') || ($yesno eq '')) {
print "OK, we're using PGP.\n";
require "Html/data/pgp.dat";
if ($sc_use_pgp eq "yes") {
system("pgp -ka Html/data/public.pgp shopkeeper"); # must have the PGP text file here
} else {
print "Um, you need to configure your public key in the shop setup.\n";
print "I haven't added a key to the keyring - PGP will not work til you do that.\n";
}
$pgplocation = `whereis pgp`;
$pgplocation =~ s/$pgp://;
$pgplocation =~ s/\S+\.\S+//;
@pgplocation = split(/\s+/, $pgplocation);
if (!@pgplocation) {
print "Can't find pgp. Aborting.\n";
print "You can't install this without PGP installed on the system.\n";
print "Run the configure script again and choose No when asked if you want PGP.\n";
exit;
} elsif (scalar(@pgplocation) == 1) {
$pgp = $pgplocation[0];
} else {
print "I found more than one instance of pgp:\n";
$i = 0;
foreach $thing (@pgplocation) {
$i++;
print "$i. $thing\n";
}
print "Which one should I use? ";
chop($answer = <STDIN>);
$answer--; # to get the index for the array
$pgp = $pgplocation[$answer];
}
if ($ENV{'PGPPATH'}) {
$pgppathlocation = $ENV{'PGPPATH'};
print "I've found your pgp path: $pgppathlocation\n";
} else {
print "What directory do you keep your PGP keyring in?\n";
print "(must start with / (absolute directory); leave blank for current directory)\n";
print "Keyring directory: ";
chop ($pgppathlocation = <STDIN>);
}
# add a check for user id here if you want to
} else {
print "We won't use PGP.\n";
}
chop($pwd = `pwd`);
$basehtml = "$pwd/Html/Products";
print "Set search path to $basehtml? [Yn]\n";
chop ($yesno = <STDIN>);
if (($yesno eq 'Y') || ($yesno eq 'y') || ($yesno eq '')) {
print "OK, search path set.\n";
} else {
print "What search path would you prefer to use? ";
chop ($basehtml = <STDIN>);
print "OK, using $basehtml as search path.\n";
}
print "What is the base URL for your shop (eg http://www.company.com/MyShop/): ";
chop($baseurl = <STDIN>);
$baseurl =~ s/\/$//; # standardize to no slash on end
$baseurl .= "/Html/Products";
open (CONFIGDATA, ">Html/data/configure.dat") || die "Can't open Html/data/configure.dat to write configurations: $!";
print CONFIGDATA <<"EOF";
# Data created by configure script
# Edit with care!
\$mailprog = "$sendmail";
\$sc_root_web_path = "$basehtml";
\$sc_server_url = "$baseurl";
\$pgp_path = ("$pgplocation");
\$pgp_config_files = ("$pgppathlocation");
EOF
close CONFIGDATA;
print "Finished configuring your shop.\n";
print "Untarring webstore library files...\n";
system ("gzip -d webstore.tar.gz"); #|| die "Couldn't unzip webstore.tar.gz: $!";
system ("tar -xvf webstore.tar"); #|| die "Couldn't untar webstore.tar: $!";
chmod (0755, "web_store.cgi", "sendemail.cgi", "Library/*.pl", "Library/*.cgi", "Library/*.javascript") || die "Couldn't chmod untarred files: $!";
mkdir ("Admin_files", 0755) || die "Couldn't make directory Admin_files: $!";
mkdir ("User_carts", 0755) || die "Couldn't make directory Admin_files: $!";